
add_library(StunHead
        STATIC
        stun.h
        stun.cpp
        stun_header.h
        stun_header.cpp
)

add_library(StunAttr
        STATIC
        stun.h
        stun.cpp
        stun_attribute.h
        stun_attribute.cpp
)

add_executable(app
        app.cpp
        udp_client.h
        udp_client.cpp
        stun_message.h
        stun_message.cpp
        tcp_client.h
        tcp_client.cpp
        peer.h
        peer.cpp
        p2p_punch.h
        p2p_punch.cpp
)


target_link_libraries(app
         PRIVATE
         StunHead
         StunAttr
         pthread
)


if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
    target_compile_definitions(app PUBLIC "IS_MACOS")
    target_compile_definitions(StunHead PUBLIC "IS_MACOS")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
    target_compile_definitions(app PUBLIC "IS_WINDOWS")
    target_compile_definitions(StunHead PUBLIC "IS_WINDOWS")
    target_link_libraries(app
            PRIVATE
            StunHead
            StunAttr
            ws2_32
            )
endif()






